home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
54203
/
54203.xpi
/
chrome
/
content
/
uploadpieSearch.js
< prev
next >
Wrap
Text File
|
2009-12-10
|
2KB
|
46 lines
if(!com) var com = {};
if(!com.uploadpie) com.uploadpie = {};
if(!com.uploadpie.uploadpie_fox) com.uploadpie.uploadpie_fox = {};
com.uploadpie.uploadpie_fox = {
uploadpie_URL: "http://uploadpie.com",
targetURL: '',
copyToClip: function(url) {
const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
gClipboardHelper.copyString(url);
},
showImageContext: function() {
var uploadpie_fox = com.uploadpie.uploadpie_fox;
document.getElementById("context-uploadpie-search").hidden = true;
if(gContextMenu.onImage) {
uploadpie_fox.targetURL = gContextMenu.mediaURL;
if(!uploadpie_fox.targetURL) {
uploadpie_fox.targetURL = gContextMenu.imageURL;
}
document.getElementById("context-uploadpie-search").hidden = false;
}
},
showImageInit: function() {
var menu = document.getElementById("contentAreaContextMenu");
menu.addEventListener("popupshowing", com.uploadpie.uploadpie_fox.showImageContext, false);
},
uploadpieSearch: function(expire) {
var uploadpie_fox = com.uploadpie.uploadpie_fox;
if(!uploadpie_fox.targetURL) return;
var location = uploadpie_fox.uploadpie_URL + '/extension.php?&url=' + encodeURIComponent(uploadpie_fox.targetURL) + '&expire=' + expire;
gBrowser.selectedTab = gBrowser.addTab(location);
var newTab = gBrowser.getBrowserForTab(gBrowser.selectedTab);
newTab.addEventListener("load", function() {
uploaded = content.document.getElementById("uploaded").value;
uploadpie_fox.copyToClip(uploaded);
}, true);
uploadpie_fox.targetURL = ''; // Reset
}
}
window.addEventListener("load", com.uploadpie.uploadpie_fox.showImageInit, false);